package com.emergency.db.dao.staff;

import org.springframework.data.domain.Page;
import com.emergency.db.domain.staff.StaffLocation;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;


public interface StaffLocationDao extends JpaRepository<StaffLocation, Long>, JpaSpecificationExecutor<StaffLocation> {
    @Modifying
    @Query(value = "delete FROM bas_staff_location WHERE staff_id = ? ", nativeQuery = true)
    void deleteAllByStaff(Long id);

    @Query(value = "select * from bas_staff_location where staff_id = ?", nativeQuery = true)
    Page<StaffLocation> findAllByStaff(Long id, Pageable p);
}
